﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Shamrock.Models.Message>" %>

    <% if (false) { %><script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script><% } %>
    <% if (false) { %><script src="../../Scripts/jquery.fuGMAP.min.js" type="text/javascript"></script><% } %>
    <script src="<%= Url.Content("~/Scripts/Map/Gmaps.js") %>" type="text/javascript"></script>

    <% using (Html.BeginForm(null, "Home", FormMethod.Post, new { enctype = "multipart/form-data" })) {%>

    <div class="postform">
    <% Html.RenderPartial("MapForm", Model); %>
    <%= Html.HiddenFor(model => model.ParentID) %>
        <table>
        <tr>
            <td class="form_bg">名 稱</td>
            <td><%= Html.TextBoxFor(model => model.Poster) %></td>
        </tr>
        <tr>
            <td class="form_bg">E-mail</td>
            <td><%= Html.TextBoxFor(model => model.Email) %></td>
        </tr>
        <tr>
            <td class="form_bg">標 題</td>
            <td><%= Html.TextBoxFor(model => model.Subject) %> <input type="submit" value="送出" /></td>
        </tr>
        <tr>
            <td class="form_bg">內 文</td>
            <td><%= Html.TextAreaFor(model => model.Comment) %></td>
        </tr>
        <tr>
            <td class="form_bg">File</td>
            <td><input id="File" type="file" name="file" /></td>
        </tr>
        <tr>
            <td class="form_bg">Address</td>
            <td><%= Html.TextBoxFor(model => model.Map.Address) %></td>
        </tr>
        </table>
        <%= Html.HiddenFor(model => Model.Map.Latitude)%>
        <%= Html.HiddenFor(model => Model.Map.Longitude)%>
        <%= Html.HiddenFor(model => Model.Map.Zoom) %>
        <input type="hidden" id="Map_ServiceName" name="Map.ServiceName" value="GoogleMaps" />
    </div>
    <% } %>

<script type="text/javascript">
//<![CDATA[
    $(document).ready(function () {
        $('#Map_Address').blur(function () {
            $('#Map_Latitude').val('');
            $('#Map_Longitude').val('');
            var sendAddress = jQuery.trim($('#Map_Address').val());
            if (sendAddress.length < 1)
                return;
            GoogleMaps.FindAddress(sendAddress);
        });
    });
//]]>
</script>

